﻿using DAL;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace DianShangHouTai.Models
{
    public class ModuleService : BaseService<Module>
    {
        public static List<Module> GetModule(int page, int limit, string MModuleName)
        {
            List<Module> list = new List<Module>();
            using (ShopContext db = new ShopContext())
            {
                var query = db.Module.Where(p => true);
                if (!string.IsNullOrEmpty(MModuleName))
                {
                    query = query.Where(p => p.MModuleName.Contains(MModuleName));
                }
                list = query.OrderByDescending(p => p.MId).Skip((page - 1) * limit).Take(limit).ToList();
            }
            return list;

        }
    }
}